<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAdminWithdrawOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin_withdraw_orders', function (Blueprint $table) {
            $table->unsignedBigInteger('id')->primary();
            $table->unsignedBigInteger('user_id')->default(0)->comment('用户ID')->index('user');
            $table->unsignedBigInteger('amount')->default(0)->comment('提现金额(分)');
            $table->enum('status',['NORMAL','SUCCESS','ERROR'])->nullable()->comment('NORMAL等待提现SUCCESS提现完成ERROR提现失败');
            $table->enum('channel',['WECHAT','ALIPAY','CASH'])->nullable()->comment('WECHATL微信支付ALIPAY支付宝CASH现金');
            $table->string('error_info')->nullable()->default('')->comment('错误信息');
            $table->string('platform_open_id',64)->nullable()->default('')->comment('平台openid');
            $table->string('platform_order_no',64)->nullable()->default('')->comment('平台订单号');
            $table->string('desc')->nullable()->default('')->comment('付款备注');
            $table->timestamps();
            $table->softDeletes();
            $table->charset = 'utf8mb4';
            $table->collation = 'utf8mb4_unicode_ci';
            $table->engine = 'InnoDB';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin_withdraw_orders');
    }
}
